export default {
  computed: {
    // 表格中列字段
    columns() {
      return [
        {
          key: "sf_code",
          title: {
            "zh-CN": "岗位编码",
            "en-US": "sf_code",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          show: true,
        },
        {
          key: "sf_name",
          title: {
            "zh-CN": "岗位名称",
            "en-US": "sf_name",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          show: true,
        },
        {
          key: "departmentCode",
          title: {
            "zh-CN": "部门编码",
            "en-US": "departmentCode",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          show: true,
          render: (h, params) => {
            return h(
              "div",
              {},
              this.getOptionValueByCascader(
                this.departmentOptions,
                params.row.departmentName || [],
                "code"
              )
            );
          },
        },
        {
          key: "departmentName",
          title: {
            "zh-CN": "部门名称",
            "en-US": "departmentName",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          show: true,
          config: {
            type: "cascader",
            options: this.departmentOptions,
            disabled: true,
          },
          render: (h, params) => {
            return h(
              "div",
              {},
              this.getOptionValueByCascader(
                this.departmentOptions,
                params.row.departmentName || []
              )
            );
          },
        },
        {
          key: "heightCode",
          title: {
            "zh-CN": "上级岗位编码",
            "en-US": "heightCode",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          show: true,
          render: (h, params) => {
            return h(
              "div",
              {},
              this.getOptionValue(
                this.jobOptions,
                params.row.heightName,
                "value"
              )
            );
          },
        },
        {
          key: "heightName",
          title: {
            "zh-CN": "上级岗位名称",
            "en-US": "heightName",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          show: true,
          render: (h, params) => {
            return h(
              "div",
              {},
              this.getOptionValue(this.jobOptions, params.row.heightName)
            );
          },
        },
        {
          key: "roleCode",
          title: {
            "zh-CN": "所属角色编号",
            "en-US": "roleCode",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          show: true,
          render: (h, params) => {
            return h(
              "div",
              {},
              this.getOptionValueByArray(
                this.roleList,
                params.row.roleName,
                "value"
              )
            );
          },
        },
        {
          key: "roleName",
          title: {
            "zh-CN": "所属角色名称",
            "en-US": "roleName",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          show: true,
          config: {
            type: "multiSelect",
            options: this.roleList,
            disabled: true,
          },
          render: (h, params) => {
            return h(
              "div",
              {},
              this.getOptionValueByArray(this.roleList, params.row.roleName)
            );
          },
        },
        {
          key: "remark",
          title: {
            "zh-CN": "备注",
            "en-US": "remark",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          show: true,
        },
      ];
    },
    // form中列字段
    formColumns() {
      return [
        {
          key: "sf_code",
          title: {
            "zh-CN": "岗位编码",
            "en-US": "sf_code",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          config: { type: "text" },
        },
        {
          key: "sf_name",
          title: {
            "zh-CN": "岗位名称",
            "en-US": "sf_name",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          config: { type: "text" },
        },
        {
          key: "departmentName",
          title: {
            "zh-CN": "部门名称",
            "en-US": "departmentName",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          config: { type: "cascader", options: this.departmentOptions },
        },
        {
          key: "heightName",
          title: {
            "zh-CN": "上级岗位名称",
            "en-US": "heightName",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          config: { type: "select", options: this.seniorJobOptions },
        },
        {
          key: "roleName",
          title: {
            "zh-CN": "所属角色名称",
            "en-US": "roleName",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          config: { type: "multiSelect", options: this.roleList },
        },
        {
          key: "remark",
          title: {
            "zh-CN": "备注",
            "en-US": "remark",
          }[this.G_Locale],
          minWidth: 100,
          align: "center",
          config: { type: "textarea" },
        },
      ];
    },
    queryFormItem() {
      return [
        {
          key: "sf_code",
          title: {
            "zh-CN": "岗位编码",
            "en-US": "sf_code",
          }[this.G_Locale],
          config: {
            type: "text",
          },
        },
        {
          key: "sf_name",
          title: {
            "zh-CN": "岗位名称",
            "en-US": "sf_name",
          }[this.G_Locale],
          config: {
            type: "text",
          },
        },
      ];
    },
    collapseFormItem() {
      return [
        {
          key: "sf_code",
          title: {
            "zh-CN": "岗位编码",
            "en-US": "sf_code",
          }[this.G_Locale],
          config: {
            type: "text",
          },
        },
        {
          key: "sf_name",
          title: {
            "zh-CN": "岗位名称",
            "en-US": "sf_name",
          }[this.G_Locale],
          config: {
            type: "text",
          },
        },
      ];
    },
    lang() {
      return {
        "en-US": {
          cancel: "cancel",
          confirmDelete: "confirm delete?",
        },
        "zh-CN": {
          cancel: "取消",
          confirmDelete: "确认删除？",
        },
      }[this.G_Locale];
    },
  },
};
